<?php
	include_once '../../../ketnoi.php';
	$MaSoTietKiem = $_GET["masotietkiem"];
	$sqlsotietkiem = "SELECT * FROM sotietkiem WHERE MaSoTietKiem ='$MaSoTietKiem'";
	$dssotietkiem = mysql_query($sqlsotietkiem);
	$dongsotietkiem = mysql_fetch_array($dssotietkiem);
	$SoTienGui = $dongsotietkiem["SoDuKyHanTT"];
	$MaLoaiKyHan = $dongsotietkiem["MaLoaiKyHan"];
	$MaLaiSuatGui = $dongsotietkiem["MaLaiSuatGui"];
	
	$sqlloaikyhan = "SELECT * FROM loaikyhan WHERE MaLoaiKyHan = $MaLoaiKyHan";
	$dsloaikyhan = mysql_query($sqlloaikyhan);
	$dongloaikyhan = mysql_fetch_array($dsloaikyhan);
	$KyHan = $dongloaikyhan["KyHan"];
	
	$sqllaisuatgui = "SELECT * FROM laisuatgui WHERE MaLaiSuatGui = $MaLaiSuatGui";
	$dslaisuatgui = mysql_query($sqllaisuatgui);
	$donglaisuatgui = mysql_fetch_array($dslaisuatgui);
	$PhanTramLaiSuatGui = $donglaisuatgui["PhanTramLaiSuatGui"];
	$HangThang = $donglaisuatgui["HangThang"];
	
	if($HangThang == 1) 
	{
		echo round($SoTienGui * ((float)$PhanTramLaiSuatGui / 100) * $KyHan);
	}
	else 
	{
		echo round($SoTienGui * ((float)$PhanTramLaiSuatGui / 100) / 12 * $KyHan);
	}
?>